/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software
 * License version 1.1, a copy of which has been included with this
 * distribution in the LICENSE.txt file.  */

package com.dream52.pms.common;

import org.apache.log4j.Category;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
   A simple example showing logger subclassing.

   <p>See <b><a href="doc-files/MyLogger.java">source code</a></b>
   for more details.

   <p>See {@link MyLoggerTest} for a usage example.
*/
public class MyLogger extends Logger
{
   static String FQCN = MyLogger.class.getName() + ".";
   private static MyLoggerFactory myFactory = new MyLoggerFactory ();

   /**
     Just calls the parent constuctor.
   @roseuid 3D225F2702A6
   */
   public MyLogger(String name)
   {
    super(name);
   }

   /**
     Overrides the standard debug method by appending " world" at the
     end of each message.
   @roseuid 3D225F2702B0
   */
   public void debug(Object message)
   {
      super.log(FQCN, Level.DEBUG, message, null);
   }

   /**
     This method overrides {@link Logger#getInstance} by supplying
     its own factory type as a parameter.
   @roseuid 3D225F2702BA
   */
   public static Category getInstance(String name)
   {
    return Logger.getLogger(name, myFactory);
   }

   /**
     This method overrides {@link Logger#getLogger} by supplying
     its own factory type as a parameter.
   @roseuid 3D225F2702C4
   */
   public static Logger getLogger(String name)
   {
    return Logger.getLogger(name, myFactory);
   }

   /**
   @roseuid 3D225F2702CE
   */
   public void trace(Object message)
   {
    super.log(FQCN, XLevel.TRACE, message, null);
   }
}
